package com.ug_project.objects

import java.util.*
import kotlin.collections.ArrayList

/**
 * Created by Administrator on 2/17/2017.
 */

infix fun <T> T?.isNotNull(action: (T) -> Unit): Boolean {
    if (this.isNotNull) {
        action(this!!)
        return true
    }
    return false
}

infix fun <T> T?.isNull(action: () -> Unit): Boolean {
    if (this.isNull) {
        action()
        return true
    }
    return false
}

/*قۇرۇق بولسا*/
val <T> T.isNull: Boolean
    get() {
        return try {
            this == null
        } catch (exception: Exception) {
            true
        }
    }

val <T> T.isNotNull: Boolean
    get() {
        return !this.isNull
    }
